package com.group525.cloudef.mapper.user;

import com.group525.cloudef.entity.user.UImage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author group525
 * @since 2023-05-24
 */
@Mapper
public interface UImageMapper extends BaseMapper<UImage> {

    //医生获取患者影像（report_no=0代表该患者还未开具诊断报告）--针对未处理的患者
    @Select("select * from u_image where user_id=#{user_id} and report_no=0")
    List<UImage> getImage(Long user_id);

    //更新预处理影像上传后的url
    @Update("update u_image set image=#{url}, preprocess=1 where image_no=#{imageId}")
    void updateImage(String url, Long imageId);
//    @Select("SELECT image_type,COUNT(*) as value FROM u_image GROUP BY image_type")
    List<Map<String,Object>>CountImageType();
}
